<template>
  <div id="earlyStageAchievementOpinion">
    <div v-show="flag==1">
      <el-row>
        <el-col :span="6">
          <div class="grid-content bg-purple-dark">&emsp;</div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple-dark box_content">
            <div class="box_content_word">项目是否变更？</div>
            <div class="btn">
              <el-button
                class="btn_"
                type="primary"
                size="small"
                @click="changeYesOrNo('APPROVED')"
              >是</el-button>
              <el-button class="btn_" size="small" @click="changeYesOrNo('REJECTED')">否</el-button>
            </div>
          </div>
        </el-col>
        <el-col :span="6">
          <div class="grid-content bg-purple-dark">&emsp;</div>
        </el-col>
      </el-row>
    </div>
    <div class="MainBox" v-show="flag==2">
      <el-form :model="submitInfo" :rules="rules" ref="submitInfo">
        <div class="boxItem">
          <div class="boxItem_title">
            <span class="tit">变更基本信息</span>
          </div>
          <div class="boxItem_content" style="padding-top:35px;">
            <el-row :gutter="20">
              <el-col :span="8">
                <div class="boxItem_content_title">
                  <p>申请变更时间：</p>
                  <div class="boxItem_content_row_item_input">
                    <el-date-picker
                      v-model="submitInfo.applicationChangeTime"
                      type="datetime"
                      :readonly="!isProgressShow"
                      value-format="yyyy-MM-dd HH:mm:ss"
                      placeholder
                    ></el-date-picker>
                  </div>
                </div>
              </el-col>
              <el-col :span="8">
                <div class="boxItem_content_title">
                  <p>批复变更时间：</p>
                  <div class="boxItem_content_row_item_input">
                    <el-date-picker
                      v-model="submitInfo.replyChangeTime"
                      type="datetime"
                      :readonly="!isProgressShow"
                      value-format="yyyy-MM-dd HH:mm:ss"
                      placeholder
                    ></el-date-picker>
                  </div>
                </div>
              </el-col>
            </el-row>
          </div>
        </div>
        <div class="boxItem boxItem1">
          <div class="boxItem_title">
            <span class="tit">变更后审定项目建设信息</span>
          </div>
          <div class="boxItem_content" style="padding-top:35px;">
            <el-row :gutter="20">
              <el-col :span="8">
                <div class="boxItem_content_title">
                  <p>复垦点个数：</p>
                  <div class="boxItem_content_row_item_input">
                    <el-form-item prop="data1.fkdgs">
                      <el-input
                        type="number"
                        v-model="submitInfo.data1.fkdgs"
                        :readonly="!isProgressShow"
                        suffix
                        placeholder
                      ></el-input>
                      <span class="inputEndText">个</span>
                    </el-form-item>
                  </div>
                </div>
              </el-col>
              <el-col :span="8">
                <div class="boxItem_content_title">
                  <p>实施规模：</p>
                  <div class="boxItem_content_row_item_input">
                    <el-form-item prop="data1.ssgm">
                      <el-input
                        type="number"
                        v-model="submitInfo.data1.ssgm"
                        :readonly="!isProgressShow"
                        suffix
                        placeholder
                      ></el-input>
                      <span class="inputEndText">公顷</span>
                    </el-form-item>
                  </div>
                </div>
              </el-col>
              <el-col :span="8">
                <div class="boxItem_content_title">
                  <p>预计减少建设用地面积：</p>
                  <div class="boxItem_content_row_item_input">
                    <el-form-item prop="data1.yjjsjsydArea">
                      <el-input
                        type="number"
                        v-model="submitInfo.data1.yjjsjsydArea"
                        suffix
                        :readonly="!isProgressShow"
                        placeholder
                      ></el-input>
                      <span class="inputEndText">公顷</span>
                    </el-form-item>
                  </div>
                </div>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="8">
                <div class="boxItem_content_title">
                  <p>预计新增耕地面积：</p>
                  <div class="boxItem_content_row_item_input">
                    <el-form-item prop="data1.yjxzgdArea">
                      <el-input
                        type="number"
                        v-model="submitInfo.data1.yjxzgdArea"
                        :readonly="!isProgressShow"
                        suffix
                        placeholder
                      ></el-input>
                      <span class="inputEndText">公顷</span>
                    </el-form-item>
                  </div>
                </div>
              </el-col>
              <el-col :span="8">
                <div class="boxItem_content_title">
                  <p>预计新增其他农用地面积：</p>
                  <div class="boxItem_content_row_item_input">
                    <el-form-item prop="data1.yjxzqtnydArea">
                      <el-input
                        type="number"
                        v-model="submitInfo.data1.yjxzqtnydArea"
                        suffix
                        :readonly="!isProgressShow"
                        placeholder
                      ></el-input>
                      <span class="inputEndText">公顷</span>
                    </el-form-item>
                  </div>
                </div>
              </el-col>
            </el-row>
          </div>
        </div>

        <div class="boxItem boxItem2">
          <div class="boxItem_title">
            <span class="tit">变更方案审定投资信息</span>
          </div>
          <div class="boxItem_content" style="padding-top:35px;">
            <el-row :gutter="20">
              <el-col :span="2">
                <p class="freeTitle">工程施工费</p>
              </el-col>
              <el-col :span="22">
                <el-row>
                  <el-col :span="8">
                    <div class="boxItem_content_title">
                      <p>拆除工程费：</p>
                      <div class="boxItem_content_row_item_input">
                        <el-form-item prop="data2.ccgcFree">
                          <el-input
                            v-model="submitInfo.data2.ccgcFree"
                            type="number"
                            @input="countMoney"
                            suffix
                            :readonly="!isProgressShow"
                            min="0"
                            placeholder
                          ></el-input>
                          <span class="inputEndText">万元</span>
                        </el-form-item>
                      </div>
                    </div>
                  </el-col>
                  <el-col :span="8">
                    <div class="boxItem_content_title">
                      <p>土地平整工程费：</p>
                      <div class="boxItem_content_row_item_input">
                        <el-form-item prop="data2.tdpzFree">
                          <el-input
                            v-model="submitInfo.data2.tdpzFree"
                            type="number"
                            @input="countMoney"
                            suffix
                            :readonly="!isProgressShow"
                            min="0"
                            placeholder
                          ></el-input>
                          <span class="inputEndText">万元</span>
                        </el-form-item>
                      </div>
                    </div>
                  </el-col>
                  <el-col :span="8">
                    <div class="boxItem_content_title">
                      <p>农田水利工程费：</p>
                      <div class="boxItem_content_row_item_input">
                        <el-form-item prop="data2.ntslFree">
                          <el-input
                            v-model="submitInfo.data2.ntslFree"
                            type="number"
                            @input="countMoney"
                            :readonly="!isProgressShow"
                            suffix
                            min="0"
                            placeholder
                          ></el-input>
                          <span class="inputEndText">万元</span>
                        </el-form-item>
                      </div>
                    </div>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <div class="boxItem_content_title">
                      <p>田间道路工程费：</p>
                      <div class="boxItem_content_row_item_input">
                        <el-form-item prop="data2.tjdlFree">
                          <el-input
                            v-model="submitInfo.data2.tjdlFree"
                            type="number"
                            @input="countMoney"
                            :readonly="!isProgressShow"
                            suffix
                            min="0"
                            placeholder
                          ></el-input>
                          <span class="inputEndText">万元</span>
                        </el-form-item>
                      </div>
                    </div>
                  </el-col>
                  <el-col :span="8">
                    <div class="boxItem_content_title">
                      <p>其它施工费：</p>
                      <div class="boxItem_content_row_item_input">
                        <el-form-item prop="data2.qtFree">
                          <el-input
                            v-model="submitInfo.data2.qtFree"
                            type="number"
                            @input="countMoney"
                            :readonly="!isProgressShow"
                            suffix
                            min="0"
                            placeholder
                          ></el-input>
                          <span class="inputEndText">万元</span>
                        </el-form-item>
                      </div>
                    </div>
                  </el-col>
                </el-row>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="2">
                <p class="freeTitle">其他费用</p>
              </el-col>
              <el-col :span="22">
                <el-row>
                  <el-col :span="8">
                    <div class="boxItem_content_title">
                      <p>前期工作费：</p>
                      <div class="boxItem_content_row_item_input">
                        <el-form-item prop="data2.qqgzFree">
                          <el-input
                            v-model="submitInfo.data2.qqgzFree"
                            type="number"
                            @input="countMoney"
                            :readonly="!isProgressShow"
                            suffix
                            min="0"
                            placeholder
                          ></el-input>

                          <span class="inputEndText">万元</span>
                        </el-form-item>
                      </div>
                    </div>
                  </el-col>
                  <el-col :span="8">
                    <div class="boxItem_content_title">
                      <p>工程监理费：</p>
                      <div class="boxItem_content_row_item_input">
                        <el-form-item prop="data2.gcjlFree">
                          <el-input
                            v-model="submitInfo.data2.gcjlFree"
                            type="number"
                            @input="countMoney"
                            :readonly="!isProgressShow"
                            suffix
                            min="0"
                            placeholder
                          ></el-input>

                          <span class="inputEndText">万元</span>
                        </el-form-item>
                      </div>
                    </div>
                  </el-col>
                  <el-col :span="8">
                    <div class="boxItem_content_title">
                      <p>设备购置费：</p>
                      <div class="boxItem_content_row_item_input">
                        <el-form-item prop="data2.sbgzFree">
                          <el-input
                            v-model="submitInfo.data2.sbgzFree"
                            :readonly="!isProgressShow"
                            type="number"
                            @input="countMoney"
                            suffix
                            min="0"
                            placeholder
                          ></el-input>

                          <span class="inputEndText">万元</span>
                        </el-form-item>
                      </div>
                    </div>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <div class="boxItem_content_title">
                      <p>竣工验收费：</p>
                      <div class="boxItem_content_row_item_input">
                        <el-form-item prop="data2.jgysFree">
                          <el-input
                            v-model="submitInfo.data2.jgysFree"
                            type="number"
                            @input="countMoney"
                            :readonly="!isProgressShow"
                            suffix
                            min="0"
                            placeholder
                          ></el-input>

                          <span class="inputEndText">万元</span>
                        </el-form-item>
                      </div>
                    </div>
                  </el-col>
                  <el-col :span="8">
                    <div class="boxItem_content_title">
                      <p>业主管理费：</p>
                      <div class="boxItem_content_row_item_input">
                        <el-form-item prop="data2.yzglFree">
                          <el-input
                            v-model="submitInfo.data2.yzglFree"
                            type="number"
                            @input="countMoney"
                            :readonly="!isProgressShow"
                            suffix
                            min="0"
                            placeholder
                          ></el-input>

                          <span class="inputEndText">万元</span>
                        </el-form-item>
                      </div>
                    </div>
                  </el-col>
                  <el-col :span="8">
                    <div class="boxItem_content_title">
                      <p>安全配套费：</p>
                      <div class="boxItem_content_row_item_input">
                        <el-form-item prop="data2.aqptFree">
                          <el-input
                            v-model="submitInfo.data2.aqptFree"
                            type="number"
                            :readonly="!isProgressShow"
                            @input="countMoney"
                            suffix
                            min="0"
                            placeholder
                          ></el-input>

                          <span class="inputEndText">万元</span>
                        </el-form-item>
                      </div>
                    </div>
                  </el-col>
                </el-row>
              </el-col>
            </el-row>

            <el-row :gutter="20" class="boxItem_content_row marginBottom" style="margin-top:20px;">
              <el-col :span="2">
                <p class="freeTitle">不可预见费用</p>
              </el-col>
              <el-col :span="22">
                <el-row :gutter="20">
                  <el-col :span="8">
                    <div class="boxItem_content_row_item_input">
                      <el-form-item prop="data2.bukyjFree">
                        <el-input
                          v-model="submitInfo.data2.bukyjFree"
                          type="number"
                          @input="countMoney"
                          :readonly="!isProgressShow"
                          suffix
                          min="0"
                          placeholder
                        ></el-input>

                        <span class="inputEndText">万元</span>
                      </el-form-item>
                    </div>
                  </el-col>
                </el-row>
              </el-col>
            </el-row>
            <el-row :gutter="20" class="boxItem_content_row">
              <el-col :span="2">
                <p class="totalMoney">总投资</p>
              </el-col>
              <el-col :span="22">
                <el-row :gutter="20">
                  <el-col :span="8">
                    <div class="boxItem_content_row_item_input">
                      <el-input v-model="allMoney" readonly suffix placeholder></el-input>
                      <span class="inputEndText">万元</span>
                    </div>
                  </el-col>
                </el-row>
              </el-col>
            </el-row>
          </div>
        </div>
      </el-form>
      <div class="boxItem">
        <div class="boxItem_title">
          <span class="tit">变更后审查资料</span>
        </div>
        <div class="boxItem_content" style="padding-top:35px;">
          <div class="boxItem_content_row">
            <div class="boxItem_content_row_item">
              <p>变更后审查资料模板</p>
              <div class>
                <el-button @click="download">下载</el-button>
              </div>
            </div>
          </div>
          <div class="boxItem_content_row">
            <div class="boxItem_content_row_item">
              <p>变更后审查资料</p>
              <div class="upLoadImg">
                <upload @beforeUpload="beforeUpload" @res="getRes" :accept="'.zip'" />
              </div>
            </div>
          </div>
          <div class="uploadResult" v-loading="isResultLoading">
            <!-- <div class="boxItem_content_row">
              <p class="uploadQuestionsTitle" v-if="landFlag=='false'">上传的文件存在问题！</p>
              <el-button style="background: #e65f2e;color:white" @click="exportYiwen">导出系统自动检测意见</el-button>
            </div>
            <div class="boxItem_content_row marginTop20">
              <p>上传结果</p>
              <el-select v-model="resultValue" placeholder="--请选择--" style="margin:0px 20px;">
                <el-option label="正常片块" value="true"></el-option>
                <el-option label="疑问片块" value="false"></el-option>
              </el-select>
              <el-button type="primary" @click="getEntryResult">查询</el-button>
            </div>-->

            <div class="marginTop20">
              <el-table :data="pianKuai" style="width: 100%">
                <el-table-column prop="fileName" label="片块名称"></el-table-column>

                <el-table-column prop="fileStatus" label="规划图">
                  <template slot-scope="scope">
                    <span
                      :class="scope.row.flag=='true'?'':'uploadQuestionsTitle'"
                    >{{scope.row.fileStatus}}</span>
                  </template>
                </el-table-column>
              </el-table>
              <div class="pageStyle">
                <el-pagination
                  @size-change="handleSizeChange"
                  @current-change="handleCurrentChange"
                  :current-page="needInfo.page"
                  :page-sizes="[10, 20, 30, 40]"
                  :page-size="needInfo.size"
                  layout="total, sizes, prev, pager, next, jumper"
                  :total="total"
                ></el-pagination>
              </div>
            </div>
            <div class="marginTop20">
              <div class="title">附件信息</div>
              <el-table :data="xiangMu" border style="width: 100%">
                <el-table-column prop="fileName" label="附件名称"></el-table-column>
                <el-table-column prop label="状态">
                  <template slot-scope="scope">
                    <span
                      :class="scope.row.flag=='true'?'':'uploadQuestionsTitle'"
                    >{{scope.row.fileStatus}}</span>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </div>
          <div class="btn" v-if="isProgressShow">
            <el-button
              type="primary"
              :disabled="noUpload"
              @click="btnProgress"
              :loading="isLoading"
            >提交</el-button>
            <el-button @click="getClear">取消</el-button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { upImg } from "@/api/upImg";
import {
  saveInfo,
  saveAgain,
  judgeChangeSave,
  queryConstructingPlanChangeResultLand,
  queryConstructingPlanChangeResultFile,
  constructingPlanChangeResultCommit,
  queryByProject
} from "@/api/projectImplementation";
import upload from "@/components/upload";
export default {
  components: {
    upload
  },
  data() {
    return {
      flag: 1,
      noUpload: false,
      allMoney: "", //总投资
      elseMoney: "", //其他费用
      rules: {
        applicationChangeTime: [
          {
            type: "date",
            required: true,
            message: "请选择申请变更时间",
            trigger: "change"
          }
        ],
        replyChangeTime: [
          {
            type: "date",
            required: true,
            message: "请选择批复变更时间",
            trigger: "change"
          }
        ],
        data1: {
          fkdgs: [
            { required: true, message: "请输入复垦点个数", trigger: "blur" }
          ],
          ssgm: [
            { required: true, message: "请输入实施规模", trigger: "blur" }
          ],
          yjjsjsydArea: [
            {
              required: true,
              message: "请输入预计减少建设用地面积",
              trigger: "blur"
            }
          ],
          yjxzgdArea: [
            {
              required: true,
              message: "请输入预计新增耕地面积",
              trigger: "blur"
            }
          ],
          yjxzqtnydArea: [
            {
              required: true,
              message: "请输入预计新增其他农用地面积",
              trigger: "blur"
            }
          ]
        },
        data2: {
          ccgcFree: [
            { required: true, message: "请输入拆除工程费", trigger: "blur" }
          ],
          tdpzFree: [
            { required: true, message: "请输入土地平整工程费", trigger: "blur" }
          ],
          ntslFree: [
            { required: true, message: "请输入农田水利工程费", trigger: "blur" }
          ],
          tjdlFree: [
            { required: true, message: "请输入田间道路工程费", trigger: "blur" }
          ],
          qtFree: [
            { required: true, message: "请输入其它施工费", trigger: "blur" }
          ],
          qqgzFree: [
            { required: true, message: "请输入前期工作费", trigger: "blur" }
          ],
          gcjlFree: [
            { required: true, message: "请输入工程监理费", trigger: "blur" }
          ],
          sbgzFree: [
            { required: true, message: "请输入设备购置费", trigger: "blur" }
          ],
          jgysFree: [
            { required: true, message: "请输入竣工验收费", trigger: "blur" }
          ],
          yzglFree: [
            { required: true, message: "请输入业主管理费", trigger: "blur" }
          ],
          aqptFree: [
            { required: true, message: "请输入安全配套费", trigger: "blur" }
          ],
          bukyjFree: [
            { required: true, message: "请输入不可预见费用", trigger: "blur" }
          ]
        }
      },
      submitInfo: {
        applicationChangeTime: null, //申请变更时间
        replyChangeTime: null, //批复变更时间
        data1: {
          fkdgs: "",
          ssgm: "",
          yjjsjsydArea: "",
          yjxzgdArea: "",
          yjxzqtnydArea: ""
        },
        data2: {
          gcsgFree: "",
          ccgcFree: "",
          tdpzFree: "",
          ntslFree: "",
          tjdlFree: "",
          qtFree: "",
          qqgzFree: "",
          gcjlFree: "",
          sbgzFree: "",
          jgysFree: "",
          yzglFree: "",
          aqptFree: "",
          bukyjFree: ""
        }
      },
      uploadText1: "上传",
      fileData1: {
        fileName: "",
        fileUrl: "",
        id: ""
      },
      isFirst: true,
      isLoading: false,

      needInfo: {
        page: 1,
        size: 10
      },
      total: 0,

      landFlag: "", //是否显示（导出上传结果）
      fileId: "", //文件id

      isResultLoading: false,
      pianKuai: [], //片块信息
      xiangMu: [], //项目信息
      isProgressShow: false
    };
  },
  created() {
    if (localStorage.getItem("router") == "PROJECT_WHETHER_UPDATE") {
      this.flag = 1;
      this.isProgressShow = false;
    } else if (localStorage.getItem("router") == "PROJECT_UPDATE_INFO_SAVE") {
      this.flag = 2;
      this.isProgressShow = true;
    } else {
      this.flag = 2;
      this.isProgressShow = false;
      this.getShow();
    }

    if (localStorage.getItem("lookStatus") == 2) {
      this.flag = 2;
      this.isProgressShow = false;
      this.getShow();
    }
    this.getEntryResult();
    this.getEntryFujian();
  },
  methods: {
    getShow() {
      //数据回显
      let obj = {
        projectId: localStorage.getItem("projectId")
      };
      queryByProject(obj).then(res => {
        this.submitInfo.applicationChangeTime = res.data.applyChangeDate;
        this.submitInfo.replyChangeTime = res.data.replyChangeDate;
        this.allMoney = res.data.ztz;
        this.submitInfo = {
          data1: {
            fkdgs: res.data.fkdgs != null ? res.data.fkdgs : "",
            ssgm: res.data.ssgm,
            yjjsjsydArea: res.data.yjjsj,
            yjxzgdArea: res.data.yjzjg,
            yjxzqtnydArea: res.data.yjzjq
          },
          data2: {
            //gcsgFree: "",
            ccgcFree: res.data.ccgcf,
            tdpzFree: res.data.tdpzgcf,
            ntslFree: res.data.ntslgcf,
            tjdlFree: res.data.tjdlgcf,
            qtFree: res.data.qtsgf,
            qqgzFree: res.data.qqgzf,
            gcjlFree: res.data.gcjlf,
            sbgzFree: res.data.sbgzf,
            jgysFree: res.data.jgysf,
            yzglFree: res.data.yzglf,
            aqptFree: res.data.aqptf,
            bukyjFree: res.data.bkyjfy
          }
        };
      });
    },
    btnProgress() {
      let that = this;
      let obj = {
        projectId: localStorage.getItem("projectId"),
        applyChangeDate:
          that.submitInfo.applicationChangeTime == ""
            ? null
            : that.submitInfo.applicationChangeTime,
        replyChangeDate:
          that.submitInfo.replyChangeTime == ""
            ? null
            : that.submitInfo.replyChangeTime,
        fkdgs: that.submitInfo.data1.fkdgs,
        ssgm: that.submitInfo.data1.ssgm,
        yjjsj: that.submitInfo.data1.yjjsjsydArea,
        yjzjg: that.submitInfo.data1.yjxzgdArea,
        yjzjq: that.submitInfo.data1.yjxzqtnydArea,
        gcsgf: that.submitInfo.data2.gcsgFree,
        ccgcf: that.submitInfo.data2.ccgcFree,
        tdpzgcf: that.submitInfo.data2.tdpzFree,
        ntslgcf: that.submitInfo.data2.ntslFree,
        tjdlgcf: that.submitInfo.data2.tjdlFree,
        qtsgf: that.submitInfo.data2.qtFree,
        qqgzf: that.submitInfo.data2.qqgzFree,
        gcjlf: that.submitInfo.data2.gcjlFree,
        sbgzf: that.submitInfo.data2.sbgzFree,
        jgysf: that.submitInfo.data2.jgysFree,
        yzglf: that.submitInfo.data2.yzglFree,
        aqptf: that.submitInfo.data2.aqptFree,
        bkyjfy: that.submitInfo.data2.bukyjFree
      };
      this.isLoading = true;
      constructingPlanChangeResultCommit(obj)
        .then(res => {
          this.isLoading = false;
          if (res.code == 1000) {
            this.$alert("当前流程办理完成", "提示", {
              confirmButtonText: "确定",
              callback: action => {
                this.$router.push({
                  path: "/xmss/ywdeal"
                });
                this.getShow();
              }
            });
          }
        })
        .catch(error => {
          this.isLoading = false;
        });
    },
    getEntryResult() {
      //成果录入回显
      let obj = {
        projectId: localStorage.getItem("projectId"),
        page: this.needInfo.page,
        size: this.needInfo.size
      };
      this.isResultLoading = true;
      queryConstructingPlanChangeResultLand(obj)
        .then(res => {
          this.isResultLoading = false;
          this.pianKuai = res.data.rows;
          this.total = res.data.total;
        })
        .catch(error => {
          this.isResultLoading = false;
        });
    },
    getEntryFujian() {
      //成果附件回显
      let obj = {
        projectId: localStorage.getItem("projectId")
      };
      this.isResultLoading = true;
      queryConstructingPlanChangeResultFile(obj)
        .then(res => {
          this.isResultLoading = false;
          this.xiangMu = res.data;
        })
        .catch(error => {
          this.isResultLoading = false;
        });
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.needInfo.size = val;
      this.getEntryResult();
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.needInfo.page = val;
      this.getEntryResult();
    },
    changeYesOrNo(type) {
      //项目是否变更
      let obj = {
        projectId: localStorage.getItem("projectId"),
        auditResult: type
      };
      judgeChangeSave(obj).then(res => {
        console.log(res, "ress123");
        if (res.code == 1000) {
          if (type == "APPROVED") {
            this.flag = 2;
          } else if (type == "REJECTED") {
            this.$confirm(res.data, "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消"
            })
              .then(() => {
                this.$router.push({
                  path: "/xmss/ywdeal"
                });
              })
              .catch(() => {});
            return;
          }
        }
      });
    },
    download() {
      var a = document.createElement("a");
      a.setAttribute(
        "href",
        this.$https +
          "/pc/file/result/template/download?achievement=R_T_B_G_H_S_C_Z_L_M_B"
      );
      a.setAttribute("download", ""); // download属性
      a.click();
    },
    //上传前
    beforeUpload() {
      this.noUpload = true;
    },
    //上传后
    getRes(res) {
      console.log(res);
      this.fileData1.fileName = res.data.fileName;
      this.fileData1.fileUrl = res.data.filePath;
      this.fileData1.id = res.data.id;
      this.noUpload = false;
      this.$message({
        message: "上传成功",
        type: "success"
      });
      this.$nextTick(() => {
        this.btnSubmit();
      });
    },
    //计算费用
    countMoney() {
      this.submitInfo.data2.gcsgFree =
        Number(
          this.submitInfo.data2.ccgcFree != ""
            ? this.submitInfo.data2.ccgcFree
            : 0
        ) +
        Number(
          this.submitInfo.data2.tdpzFree != ""
            ? this.submitInfo.data2.tdpzFree
            : 0
        ) +
        Number(
          +this.submitInfo.data2.ntslFree != ""
            ? this.submitInfo.data2.ntslFree
            : 0
        ) +
        Number(
          this.submitInfo.data2.tjdlFree != ""
            ? this.submitInfo.data2.tjdlFree
            : 0
        ) +
        Number(
          this.submitInfo.data2.qtFree != "" ? this.submitInfo.data2.qtFree : 0
        );

      this.elseMoney =
        Number(
          this.submitInfo.data2.qqgzFree != ""
            ? this.submitInfo.data2.qqgzFree
            : 0
        ) +
        Number(
          this.submitInfo.data2.gcjlFree != ""
            ? this.submitInfo.data2.gcjlFree
            : 0
        ) +
        Number(
          this.submitInfo.data2.sbgzFree != ""
            ? this.submitInfo.data2.sbgzFree
            : 0
        ) +
        Number(
          this.submitInfo.data2.jgysFree != ""
            ? this.submitInfo.data2.jgysFree
            : 0
        ) +
        Number(
          this.submitInfo.data2.yzglFree != ""
            ? this.submitInfo.data2.yzglFree
            : 0
        ) +
        Number(
          this.submitInfo.data2.aqptFree != ""
            ? this.submitInfo.data2.aqptFree
            : 0
        );

      this.allMoney =
        Number(
          this.submitInfo.data2.gcsgFree != ""
            ? this.submitInfo.data2.gcsgFree
            : 0
        ) +
        Number(this.elseMoney != "" ? this.elseMoney : 0) +
        Number(
          this.submitInfo.data2.bukyjFree != ""
            ? this.submitInfo.data2.bukyjFree
            : 0
        );
    },
    btnSubmit() {
      const that = this;
      console.log(that.isFirst);
      //if (that.isFirst) {
      let obj = {
        projectId: localStorage.getItem("projectId"),
        // applyChangeDate: that.getTime(that.applicationChangeTime),
        // replyChangeDate: that.getTime(that.replyChangeTime),
        // fkdgs: that.submitInfo.data1.fkdgs,
        // ssgm: that.submitInfo.data1.ssgm,
        // yjjsj: that.submitInfo.data1.yjjsjsydArea,
        // yjzjg: that.submitInfo.data1.yjxzgdArea,
        // yjzjq: that.submitInfo.data1.yjxzqtnydArea,
        // gcsgf: that.submitInfo.data2.gcsgFree,
        // ccgcf: that.submitInfo.data2.ccgcFree,
        // tdpzgcf: that.submitInfo.data2.tdpzFree,
        // ntslgcf: that.submitInfo.data2.ntslFree,
        // tjdlgcf: that.submitInfo.data2.tjdlFree,
        // qtsgf: that.submitInfo.data2.qtFree,
        // qqgzf: that.submitInfo.data2.qqgzFree,
        // gcjlf: that.submitInfo.data2.gcjlFree,
        // sbgzf: that.submitInfo.data2.sbgzFree,
        // jgysf: that.submitInfo.data2.jgysFree,
        // yzglf: that.submitInfo.data2.yzglFree,
        // aqptf: that.submitInfo.data2.aqptFree,
        // bkyjfy: that.submitInfo.data2.bukyjFree,
        planConstructingChangeResultFileId: that.fileData1.id
      };
      console.log(obj, "obj", that.isFirst);
      that.isLoading = true;
      saveInfo(obj)
        .then(res => {
          console.log(res);
          that.isLoading = false;
          this.$nextTick(() => {
            this.getEntryResult();
            this.getEntryFujian();
          });
        })
        .catch(error => {
          that.isLoading = false;
        });
    },
    getClear() {
      //清空值
      this.submitInfo.applicationChangeTime = ""; //申请变更时间
      this.submitInfo.replyChangeTime = ""; //批复变更时间
      this.submitInfo = {
        data1: {
          fkdgs: "",
          ssgm: "",
          yjjsjsydArea: "",
          yjxzgdArea: "",
          yjxzqtnydArea: ""
        },
        data2: {
          gcsgFree: "",
          ccgcFree: "",
          tdpzFree: "",
          ntslFree: "",
          tjdlFree: "",
          qtFree: "",
          qqgzFree: "",
          gcjlFree: "",
          sbgzFree: "",
          jgysFree: "",
          yzglFree: "",
          aqptFree: "",
          bukyjFree: ""
        }
      };
      this.fileData1 = {
        fileName: "",
        fileUrl: "",
        id: ""
      };
    },
    getTime(time) {
      let times = new Date(time);
      let year = times.getFullYear();
      let month =
        times.getMonth() + 1 < 10
          ? "0" + (times.getMonth() + 1)
          : times.getMonth() + 1;
      let day = times.getDate() < 10 ? "0" + times.getDate() : times.getDate();
      let hours =
        times.getHours() < 10 ? "0" + times.getHours() : times.getHours();
      let minutes =
        times.getMinutes() < 10 ? "0" + times.getMinutes() : times.getMinutes();
      let seconds =
        times.getSeconds() < 10 ? "0" + times.getSeconds() : times.getSeconds();
      time =
        year +
        "-" +
        month +
        "-" +
        day +
        " " +
        hours +
        ":" +
        minutes +
        ":" +
        seconds;
      return time;
    }
  }
};
</script>
<style lang="scss" scoped>
/deep/ .el-form-item {
  margin: 0;
}
.btn {
  padding: 30px;
}
.money {
  font-size: 13px;
  color: #606266;
}
.projectMoney {
  padding-left: 150px;
}
#earlyStageAchievementOpinion {
  padding: 30px;
  box-sizing: border-box;
}
#earlyStageAchievementOpinion .boxItem {
  width: 100%;
  background-color: #fff;
}
#earlyStageAchievementOpinion .boxItem_title {
  width: 100%;
  background: #f8f8f8;
  height: 50px;
  border: 1px solid #efefef;
  overflow: hidden;
  color: #333;
  font-size: 18px;
  font-weight: bold;
  text-indent: 20px;
  line-height: 50px;
}
#earlyStageAchievementOpinion .boxItem_content {
  width: 100%;
  border: 1px solid #ebebeb;
  border-top: none;
  padding: 30px;
  padding-top: 0;
  box-sizing: border-box;
}
#earlyStageAchievementOpinion .boxItem_content_row {
  display: flex;
  align-items: center;
}
#earlyStageAchievementOpinion .boxItem_content_row_item {
  display: flex;
  align-items: center;
}
#earlyStageAchievementOpinion .boxItem_content_row_item:nth-child(2n-1) {
  margin-right: 300px;
}
#earlyStageAchievementOpinion .boxItem_content_row_item p {
  font-size: 14px;
  line-height: 36px;
  width: 165px;
}
#earlyStageAchievementOpinion .boxItem1 .boxItem_content_row_item p {
  width: 180px;
}
#earlyStageAchievementOpinion .boxItem_content_row_item_noFlex {
  display: flex;
  width: 100%;
}
#earlyStageAchievementOpinion .boxItem_content_row_item_noFlex p {
  font-size: 14px;
  line-height: 36px;
  width: 140px;
}
#earlyStageAchievementOpinion .boxItem_content_row_item p:first-child {
  color: #444;
  font-weight: bold;
}
#earlyStageAchievementOpinion .boxItem_content_row_item p:last-child {
  color: #666;
}
#earlyStageAchievementOpinion .uploadDownLoadBox_item {
  margin: 20px 0;
}
#earlyStageAchievementOpinion .uploadDownLoadBox_item p {
  width: 140px;
}
#earlyStageAchievementOpinion .button_box {
  margin-top: 54px;
}
#earlyStageAchievementOpinion .button_box_item {
  margin-right: 10px;
}
#earlyStageAchievementOpinion .boxItem_content_row_item_input {
  position: relative;
}
#earlyStageAchievementOpinion
  .boxItem_content_row_item_input
  /deep/
  .el-input__inner {
  padding-right: 50px;
}
#earlyStageAchievementOpinion .boxItem_content_row_item_input span {
  position: absolute;
  right: 10px;
  top: 3px;
  height: 36px;
  line-height: 36px;
  z-index: 1;
  color: #999;
}
#earlyStageAchievementOpinion .table-doc-view {
  border-collapse: collapse;
}
#earlyStageAchievementOpinion .table-doc-view tr,
.table-doc-view td {
  border: 1px solid #ccc;
  padding: 10px 10px;
}
#earlyStageAchievementOpinion .table-doc-view tr,
.table-doc-view td {
  border: 1px solid #ccc;
  padding: 10px 10px;
}
#earlyStageAchievementOpinion .table-doc-view td {
  font-size: 14px;
  color: #444;
  min-height: 30px;
}
#earlyStageAchievementOpinion .table-doc-view .taoc-title {
  text-align: center;
  font-size: 18px;
  font-weight: bold;
}
#earlyStageAchievementOpinion .table-doc-view .taoc-center {
  text-align: center;
}
#earlyStageAchievementOpinion .boxItem_content_row_item_noFlex_textarea {
  width: 80%;
}
#earlyStageAchievementOpinion .shencharen {
  display: flex;
  margin-right: 102px;
  align-items: center;
}
#earlyStageAchievementOpinion .shencharen img {
  width: 105px;
  height: 59px;
}
#earlyStageAchievementOpinion .shencharenTime {
  display: flex;
  align-items: center;
}
#earlyStageAchievementOpinion .shencharenTime p {
  width: 80px;
}
#earlyStageAchievementOpinion .boxItem_content_row_shenhe {
  margin: 30px 0;
}
#earlyStageAchievementOpinion .tableBoxData_title {
  width: 100%;
  display: block;
  overflow: hidden;
  font-size: 20px;
  font-weight: bold;
  color: #444;
  text-align: center;
  margin-bottom: 10px;
}
.tableBoxData_mainData {
  width: 100%;
  display: flex;
  justify-content: center;
}
.tableBoxData_button_box {
  width: 100%;
  display: flex;
  justify-content: center;
}
.tableBoxData_button_box_item {
  margin: 0px 20px;
  margin-bottom: 20px;
  margin-top: 10px;
}
.noPiankuanList {
  width: 100%;
  box-sizing: border-box;
  padding-left: 50px;
  font-size: 20px;
  padding-top: 10px;
  text-align: center;
  color: #999;
}
#earlyStageAchievementOpinion /deep/ input::-webkit-outer-spin-button,
#earlyStageAchievementOpinion /deep/ input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
#earlyStageAchievementOpinion /deep/ input[type="number"] {
  -moz-appearance: textfield;
}
.boxItem_content_row_item p:first-child {
  text-align: right;
  margin-right: 10px;
}
.box_content {
  border: 1px solid #a1a1a1;
  box-sizing: border-box;
  margin: 20px auto;
  height: 200px;
  text-align: center;
  .box_content_word {
    color: #444;
    font-size: 16px;
    margin: 50px 20px 40px 20px;
  }
  .btn {
    text-align: center;
    .btn_ {
      width: 100px;
    }
  }
}
boxItem_content_title {
  margin-bottom: 20px;
}
.boxItem_content_title p {
  font-size: 14px;
  font-weight: bold;
  color: #606266;
}
.boxItem_content_row_item_input {
  width: 50%;
}

.freeTitle {
  font-size: 15px;
  font-weight: bold;
  color: #666;
}
.totalMoney {
  font-size: 16px;
  font-weight: bold;
  color: #333;
}
.marginBottom {
  margin-bottom: 20px;
}
.uploadResult {
  font-size: 14px;
}
.uploadQuestionsTitle {
  color: #c40000;
}
.marginTop20 {
  margin-top: 15px;
}
.boxItem_content_row_item_input_input {
  width: 200px;
}
.pageStyle {
  text-align: center;
  margin: 20px;
}
.title {
  width: 100%;
  height: 50px;
  /* text-align: center; */
  font-weight: bold;
  margin-left: 30px;
  font-size: 16px;
  line-height: 50px;
  border-bottom: none;
  border-top: none;
}
</style>
 